Ext.define('DCApp.Cfg',{
	singleton   : true,  
    VISITOR: 0.1, 
    SIM_ENM:{
//        	'Image':10,
//        	'CeAttachment':10,
//			'Doc':100,
//        	'CcPay':10,
//        	'BaseDoctype':6,
//        	'Thesis':30,
//        	'Relic':50,
//        	'BaseAuthor':30,
//        	'CeGift':30,
//        	'Building':30,
//        	'Catalog':30,
//        	'Figure':30,
//        	'AudioVideo':30,
//        	'Book':50,
//        	'Contribution':30,
//        	'Lemma':30
//        	'BaseAllograph':30
        },
    usrInfo:null,
    OPTS    : {
    	'doc_linkMan':['欧阳锋','陈刚','杨燕丽','李南书','刘盈','刘茵','林舒'],
    	'doc_type':['故宫讲坛','学术沙龙','快讯','宫廷人物','工程报道','贵宾接待'],
    	'image_imgType':['照片' ,'电子文档','扫描'],
    	'image_imgColor':['彩色' ,'黑白'],
    	'image_imageSource':['影像利用','影像局部','外来影像'],
    	'book_collectiontype':['是','否'],
        'book_commendtype':['是','否']
    } ,
    OPT_STORES:{},
    
    constructor : function(options){ 
    	this.ADMINISTRATOR='kkkkkk';
        this.initConfig(options); 
    },
    getListStore:function(model_name,entity_name,pn){
    	var storeId = 'ls_'+entity_name+'.'+pn;
    	var st = Ext.StoreManager.lookup(storeId);
    	if(st)
    		return st;
    	else return  Ext.create('Ext.data.ArrayStore', {
		    storeId: storeId,
		    pageSize: 100,
		    model: model_name,
			proxy : {  
    	    	type: 'reste',
    	        url: '/ls/'+entity_name+'/'+pn,
    	    	reader :
    	        {  
    				type : 'json',  
    				rootProperty : 'data',
    				totalProperty:'total'
    	        }
    	    }     		    
		});
    },
    getDistinctStore:function(entity_name,property_name){
    	var storeId = 'st_'+entity_name+'.'+property_name;
    	var st = Ext.StoreManager.lookup(storeId);
    	if(st)
    		return st;
    	else return  Ext.create('Ext.data.ArrayStore', {
		    storeId: storeId,
		    pageSize: 100,
		    fields: ['abbr','name'],
			proxy : {  
    	    	type: 'reste',
    	        url: '/distinct/'+entity_name+'/'+property_name,
    	    	reader :
    	        {  
    				type : 'json',  
    				rootProperty : 'data',
    				totalProperty:'total'
    	        }
    	    }     		    
		});
    },
    getStore:function(str){
    	var st = this.OPT_STORES[str];
    	if(st)
    		return st;
    	var data=[];
    	var sa = this.OPTS[str];
    	for(var i=0; i<sa.length; i++){
    		var sv = sa[i];
    		data.push({'abbr':sv,'name':sv});
    	}
    	st =  Ext.create('Ext.data.Store', {
    	    fields: ['abbr', 'name'],
    	    data:data});
    	this.OPT_STORES[str]=st;
    	return st;
    },
    addStore:function(str,val){
    	var st = this.OPT_STORES[str];
    	if(!st)
    		return;
    	var rec=st.findRecord('abbr',val);
    	if(rec)
    		return;
    	this.OPTS[str].push(val);
    	st.add({'abbr':val,'name':val});
    },
    addStores:function(sm){
    	for(var x in sm){
    		this.addStore(x,sm[x]);
    	}
    }
}); 
